package algorithms.que12;

import edu.princeton.cs.algs4.StdDraw;

import java.awt.*;

/**
 * @功能
 * @创建时间 2020/6/21
 */

public class VisualCounter10 {
    private Integer N;

    private Integer max;

    public VisualCounter10(Integer n, Integer max) {
        N = n;
        this.max = max;

        StdDraw.setPenRadius(.005);
        StdDraw.setXscale(0,this.max);
        StdDraw.setYscale(0,this.max);
    }

    public Integer add(){
        if(N<this.max)
            N++;
        StdDraw.setPenColor(Color.BLACK);
        StdDraw.point(N,N);
        return N;
    }
}
 class www{
     public static void main(String[] args) {
         VisualCounter10 visualCounter10 = new VisualCounter10(0,100);
         for(int i=0;i<100;i++){
             visualCounter10.add();
         }
         System.out.println(visualCounter10.add());
     }
}